package snsdbook.beans;

import util.SQLUtil;

public class FileBean {
  private String title_;
  private long timestamp_;
  private int id_;
  private String parity_;
    
  public FileBean(int id, int seq) {
    id_ = id;
    String id_str = String.valueOf(id);
    String[] ret = SQLUtil.Query(
        "SELECT timestamp " +
        "FROM files WHERE id_file = '" +
        id_str + "'");
    timestamp_ = Long.valueOf(ret[0]);
    
    ret = SQLUtil.Query(
        "SELECT filepath " +
        "FROM files WHERE id_file = '" +
        id_str + "'");
    title_ = ret[0];
    
    if (seq % 2 == 0) {
      parity_ = "even_content";
    } else {
      parity_ = "odd_content";
    }
  }
  
  public void setId(int id) { id_ = id; }
  
  public void setTitle(String title) { title_ = title; }
  
  public void setTimestamp(long timestamp) { timestamp_ = timestamp; }
  
  public void setParity(String parity) { parity_ = parity; }
  
  public int getId() { return id_; }
  
  public String getTitle() { return title_; }
  
  public long getTimestamp() { return timestamp_; }
  
  public String getParity() { return parity_; }
}